<template>
	<view style="display: flex;flex-direction: row;height: 27px; max-width: 70px;" @click.stop="" >
		<view class="food-control" v-if="food.count>0">
			<view class="cont"  @click.stop="decreaseCart(food)">-</view>
			<text style="width:48upx;text-align: center;">{{food.count}}</text>
		</view>
		<view class="cont" @click.stop="addCart(food)">+</view>
	</view>
</template>

<script>
	export default {
		props: {
			food: {
				type: Object,
			}
		},
		data() {
			return { };
		},
		methods: {
			addCart: function(item) {
				this.$emit('add',item)
			},
			decreaseCart(item) {
				this.$emit('dec',item)
			}
		}
	}
</script>

<style scoped lang="scss">
	.food-control {
		display: flex;
		flex: 1;
		justify-content: space-around;
	}
	.cont {
		width: 22px;
		height: 22px;
		box-sizing: border-box;
		border-radius: 50%;
		text-align: center;
		background-color: $base-color;
		line-height: 18px;
		color: #ffff;
		font-weight: 700;
		font-size: 20px;
	}
</style>
